﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SitePagePopUp.Master" AutoEventWireup="true" CodeBehind="Product.aspx.cs" Inherits="TranTekBE.Product" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BodyPopupContent" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>        
        <table style="width:100%">
            <tr>
                <td colspan="2" class="msgError"><asp:Literal ID="ltError" runat="server" />&nbsp;</td>
            </tr>
            <tr id="name">
                <td class="tdRightM" style="width:20%">Product Name:<br /><asp:Literal ID="ltProductNameErr" runat="server" /></td>
                <td class="tdLeftM" style="width:80%"><asp:TextBox ID="txtProductName" runat="server" Width="300px" MaxLength="100" /> <span class="msgError">*</span></td>
            </tr>
            <tr>
                <td class="tdRightM">Active:</td>
                <td class="tdLeftM">
                    <asp:RadioButtonList ID="rblStatus" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Text="Yes" Value="1" Selected="True" />
                        <asp:ListItem Text="No" Value="0" />
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr id="price">
                <td class="tdRightM">Price:<br /><asp:Literal ID="ltPriceErr" runat="server" /></td>
                <td class="tdLeftM"><asp:TextBox ID="txtPrice" runat="server" Width="100px" MaxLength="10" /> <span class="msgError">*</span></td>
            </tr>
            <tr id="onhand">
                <td class="tdRightM">Onhand Qty:<br /><asp:Literal ID="ltOnhandQtyErr" runat="server" /></td>
                <td class="tdLeftM"><asp:TextBox ID="txtOnhandQty" runat="server" Width="100px" MaxLength="10" /> <span class="msgError">*</span></td>
            </tr>
            <tr>
                <td class="tdRightT">Category:</td>
                <td class="tdLeftM">
                    <table style="width:100%">
                        <tr>
                            <td class="tdCenterM" style="width:45%"><asp:ListBox runat="server" ID="lbCategoryLeft" SelectionMode="Multiple" Width="99%" Height="150px" /></td>
                            <td class="tdCenterM" style="width:10%">
                                <asp:Button ID="btnMoveRight" runat="server" Text=">" Width="50px" CommandName="MoveRight" oncommand="ControlClick_Command" onclientclick="return CheckSelectItem('lbCategoryLeft');" /><br />
                                <asp:Button ID="btnMoveLeft" runat="server" Text="<" Width="50px" CommandName="MoveLeft" oncommand="ControlClick_Command" onclientclick="return CheckSelectItem('lbCategoryRight');" /><br />
                                <asp:Button ID="btnMoveAllRight" runat="server" Text=">>" Width="50px" CommandName="MoveAllRight" oncommand="ControlClick_Command" /><br />
                                <asp:Button ID="btnMoveAllLeft" runat="server" Text="<<" Width="50px" CommandName="MoveAllLeft" oncommand="ControlClick_Command" />
                            </td>
                            <td class="tdCenterM" style="width:45%"><asp:ListBox runat="server" ID="lbCategoryRight" SelectionMode="Multiple" Width="99%" Height="150px" /></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="tdRightT">Comments:</td>
                <td class="tdLeftM"><asp:TextBox ID="txtComments" runat="server" TextMode="MultiLine" Height="70px" Width="300px" MaxLength="256" /></td>
            </tr>
            <tr>
                <td colspan="2" class="tdCenterM"><asp:Button ID="btnSubmit" Text="Ok" 
                        runat="server" CommandName="Submit" Width="70px" oncommand="ControlClick_Command" /> <button id="btnCancel" style="width:70px;" type="button">Cancel</button></td>
            </tr>
        </table>
        <script type="text/javascript">
            function LoadJS(){
                $("#btnCancel").on("click", function() {
                    window.parent.CloseDialog();
                });

                $("input[id*='txtProductName'],input[id*='txtPrice'],input[id*='txtOnhandQty']").on("focus", function() {
                    $(this).parent().parent().find('.msgErrorSmall').hide();
                });
            }
            function CheckSelectItem(id) {
                if ($("select[id*='" + id + "']").val() != null)
                    return true;
                else {
                    
                    alert("Please select item(s).");
                    return false;
                }
            }
        </script>
    </ContentTemplate>
</asp:UpdatePanel>
</asp:Content>